package com.ai.model.page;

import com.ai.entity.BasePage;
import com.ai.entity.made.AlgorithmPackageStatus;
import com.ai.entity.made.CoalRoutingInspectionAlarmRecord;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * @Author jiaok
 * @Date 2024-10-29 16:25
 */
@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CoalRoutingInspectionPage extends BasePage<CoalRoutingInspectionAlarmRecord> {


    @ApiModelProperty(value = "巡检班次（1：早班，2中班，3晚班）")
    private String sequence;

    @ApiModelProperty(value = "巡检状态（1：正常，2：异常，3：巡检中）")
    private String inspectState;

    @ApiModelProperty(value = "人工审核")
    private String manualReview;


    /**
     * 区域id
     */
    private String regionBaseId;

    /**
     * 当前用户管理的区域信息
     */
    private List<String> cameraCodes;


    /**
     * 拥有的摄像头列表
     */
    private List<String> cameraIdList;


    @Override
    public QueryWrapper<CoalRoutingInspectionAlarmRecord> getQuery(QueryWrapper<CoalRoutingInspectionAlarmRecord> queryWrapper) {
        return super.getQuery(queryWrapper)
                .eq(StringUtils.isNotBlank(sequence),"sequence",sequence)
                .eq(StringUtils.isNotBlank(inspectState),"inspect_state",inspectState)
                .eq(StringUtils.isNotBlank(manualReview),"manual_review",manualReview)
                .in((!CollectionUtils.isEmpty(cameraIdList) && cameraIdList.size() > 0), "camera_id", cameraIdList)
//                .in((!CollectionUtils.isEmpty(cameraCodes) && cameraCodes.size() > 0), "camera_code", cameraCodes)
                .orderByDesc("create_time");
    }

}
